#!/usr/bin/env php
<?php

require_once __DIR__ . '/_bootstrap.php';

$requiredFormats = array_map('strtoupper', [
    'BMP',
    'GIF',
    'JPG',
    'PDF',
    'PNG',
    'SVG',
    'TIFF',
]);
$supportedFormats = array_map('strtoupper', Imagick::queryFormats());
$missingFormats = array_diff($requiredFormats, $supportedFormats);
if ($missingFormats !== []) {
    sort($missingFormats);
    fwrite(STDERR, "Imagick does NOT support these formats:\n- " . implode("\n- ", $missingFormats) . "\n");
    exit(1);
}
echo "Imagick supports at least these formats:\n- ", implode("\n- ", $requiredFormats), "\n";
